package com.cn.ant.modules.wechat.service;

import com.cn.ant.common.persistence.Page;
import com.cn.ant.common.service.BaseService;
import com.cn.ant.modules.wechat.dao.TkMovieCustomMapper;
import com.cn.ant.modules.wechat.entity.TkMovieCustom;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;
/**
 * 泰康免费观影客户信息Service
 * @author AntDream
 * @version 2015-05-09
 */
@Component
@Transactional(readOnly = true)
public class TkMovieCustomService extends BaseService {

	@Autowired
	private TkMovieCustomMapper tkMovieCustomMapper;
	
	public TkMovieCustom get(String id) {
		return tkMovieCustomMapper.get(id);
	}
	
	public Page<TkMovieCustom> find(Page<TkMovieCustom> page, Map<String,Object> param) {
        param.put("startIdx", page.getFirstResult());
        param.put("pageSize", page.getPageSize());
        page.setList(tkMovieCustomMapper.query(param));
        page.setCount(tkMovieCustomMapper.queryCount(param));
        return page;
	}

	public List<Map<String, Object>> queryTotalByArea(Map<String, Object> params) {
		return tkMovieCustomMapper.queryTotalByArea(params);
	}

	public TkMovieCustom queryByMobile(String mobile) {
		return tkMovieCustomMapper.queryByMobile(mobile);
	}
	
	@Transactional(readOnly = false)
	public void save(TkMovieCustom tkMovieCustom) {
		tkMovieCustomMapper.insert(tkMovieCustom);
	}
	
	@Transactional(readOnly = false)
	public void update(TkMovieCustom tkMovieCustom) {
		tkMovieCustomMapper.update(tkMovieCustom);
	}
	
	@Transactional(readOnly = false)
	public void delete(String id) {
		tkMovieCustomMapper.delete(id);
	}

    public List<TkMovieCustom> queryByCardNo(String cardNo) {
        return tkMovieCustomMapper.queryByCardNo(cardNo);
    }
}
